var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    txt: 'yes',
    popshow: true,
    applyFor: false,
    querylist:[
      { query: "后方可是否合适附近的爽肤水", answer: "回复框架的师傅的说法后第三方返回数据库", open: true },
      { query: "后方可是否合适附近的爽", answer: "回复框架的师傅的说法后第三方返回数据库", open: false },
      { query: "后方可是否合适附近的爽肤水", answer: "回复框架的师傅的说法后第三方返回数据库", open: false },
      { query: "后方可是否合适附近的爽肤", answer: "回复框架的师傅的说法后第三方返回数据库", open: false },
      { query: "后方可是否合适附近的爽", answer: "回复框架的师傅的说法后第三方返回数据库", open: false },
      { query: "后方可是否合适附近的爽肤", answer:"回复框架的师傅的说法后第三方返回数据库",open:false},
    ]
  },
  quitclick() {
    this.setData({
      popshow: false,
      applyFor: false
    })
  },
  allowbtn() {
    this.setData({
      popshow: false,
      applyFor: false,
      txt: ""
    })
  },
  // 调取申请
  ptiontitbtn() {
    this.setData({
      applyFor: true,
      txt:'none'
    })
  },
  openitem(e){
    let i = e.currentTarget.dataset.i, arr = this.data.querylist
    arr.map(function(list){
      list.open = false
    })
    arr[i].open = true
    this.setData({
      querylist: arr
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this
    var id = options.id
    var sid = options.sid
    that.setData({
      id: id,
      sid: sid
    })
    that.getontorder()
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
  },
  chakwliu: function (e) {
    var that = this
    var gsname = e.currentTarget.dataset.gsname
    var orders = e.currentTarget.dataset.orders
    var shname = e.currentTarget.dataset.shname
    var spid = e.currentTarget.dataset.spid
    var com = e.currentTarget.dataset.com
    var num = e.currentTarget.dataset.num
    wx.navigateTo({
      url: '/hyb_yl/userCommunicate/pages/load/load?gsname=' + gsname + '&orders=' + orders + '&shname=' + shname + '&spid=' + spid + '&com=' + com + '&num=' + num,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },
  getontorder() {
    var that = this
    var id = that.data.id
    var sid = that.data.id
    app.util.request({
      'url': 'entry/wxapp/Goods.getoneorder',
      data: {
        id: id,
        sid: sid,
      },
      success: function(res) {
        console.log(res)
        that.setData({
          info: res.data,
        })
      }
    })
  },
  copy: function() {
    var t = this.data.order.orderId.toString();
    wx.setClipboardData({
      data: t,
      success: function(t) {
        wx.getClipboardData({
          success: function() {
            wx.showToast({
              title: "复制成功",
              icon: "none",
              duration: 2e3
            });
          }
        });
      }
    });
  }
})